package com.bw.unit6.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.bw.unit3.base.BaseViewModel
import com.bw.unit6.base.BaseBean
import com.bw.unit6.bean.GoodsBean
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

/**
 *
 * @ClassName: HomeViewModel
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/19 4:49 PM
 * @Version: 1.0
 */
class GoodsViewModel : BaseViewModel() {

    val liveDataGoods = MutableLiveData<BaseBean<List<GoodsBean>>>()

    fun getGoodsList(id: Int, page: Int, size: Int) {
        viewModelScope.launch(Dispatchers.IO) {
            liveDataGoods.postValue(apiService.getGoodsList(id, page, size))

        }

    }
}